package com.sxt;

import java.awt.*;

/**
 * 背景的实体类
 */
public class BacGroundObj extends GameObject {

    //积分
    public static int score = 0;

    public BacGroundObj() {
        super();
    }

    public BacGroundObj(String image, GameWin frame) {
        super(image, frame);
    }

    public BacGroundObj(String image, int x, int y, int speedY, GameWin frame) {
        super(image, x, y, speedY, frame);
    }

    @Override
    public void paintSelf(Graphics s) {
        s.drawImage(image, x, y, null);
        //实现背景的移动
        y += speedY;
        //控制背景图循环
        if (y >= 0)
            y = GameWin.WINDOW_HEIGHT - GameWin.BACKGROUND_IMAGE_HEIGHT + GameWin.TOP_BORDER_HEIGHT;

        //积分板的实现
        s.setColor(Color.GREEN);
        s.setFont(new Font("微软雅黑", Font.BOLD, 20));
        //应该是放在右下角
        s.drawString(score + "分", GameWin.WINDOW_WIDTH - 80, GameWin.WINDOW_HEIGHT - 30);

    }
    @Override
    public void DeBug() {
        System.out.println("BacGroundObj class");
    }

    @Override
    public Rectangle getRec() {
        return null;
    }
}
